package Javatest2.iftest;

import java.util.Scanner;

public class test7 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入您的出生年");
        int brithyear = scanner.nextInt();
        System.out.println("请输入您的出生月");
        int brithmonth = scanner.nextInt();
        System.out.println("请输入您的出生日");
        int brithday = scanner.nextInt();

        System.out.println("请输入现在的年份");
        int nowyear = scanner.nextInt();
        System.out.println("请输入现在的月份");
        int nowmonth = scanner.nextInt();
        System.out.println("请输入现在的日期");
        int nowday = scanner.nextInt();

        int age = nowyear - brithyear;


        if (nowmonth < brithmonth) {
            age--;


        }

        if (
                nowmonth == brithmonth && nowday < brithday
        ) {
            age--;
        }
        System.out.println("你的年龄为" + age);

    }

}
